{include file="common/_header-css"}
  <body>
    <div class="layui-fluid">
        <div class="layui-row">
            <form action="" method="post" class="layui-form layui-form-pane">
                <div class="layui-inline layui-show-xs-block">
                    <input class="layui-input"  autocomplete="off" placeholder="开始日" name="start_date" id="start">
                </div>
                <div class="layui-inline layui-show-xs-block" style="margin-top: 10px;margin-bottom: 10px;">
                    <input class="layui-input"  autocomplete="off" placeholder="截止日" name="stop_date" id="end">
                </div>

                <!--<div class="layui-form-item">
                <label for="start" class="layui-form-label">
                    <span class="x-red">*</span>角色名
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="title" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" placeholder="开始日" name="start" id="start">
                </div>
            </div>

                <div class="layui-form-item">
                    <label for="end" class="layui-form-label">
                        <span class="x-red">*</span>角色名
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="开始日" placeholder="截止日" name="end" id="end">
                    </div>
                </div>-->

                <div class="layui-form-item layui-form-text">
                    <label for="describe" class="layui-form-label">
                        描述
                    </label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" id="describe" name="describe" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                <button class="layui-btn" type="button" id="add">增加</button>
              </div>
            </form>
        </div>
    </div>

    {include file="common/_jQuery"}
    <script>
    </script>

    <script>
        layui.use(['laydate','form'], function(){
            var laydate = layui.laydate;
            var form = layui.form;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });
        $("#add").on('click',function () {
            $.post("{:url('Integral/cycle_add')}",$('form').serialize(),function (res) {
                console.log(res);
                if (res.code == 200) {
                    layer.alert(res.msg, {icon: 6}, function () {
                        // 获得frame索引
                        // var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        // parent.layer.close(index);
                        parent.location.href='index';
                    });
                }else{
                    layer.alert(res.msg, {icon: 5});
                }
            });
        })
    </script>
  </body>

</html>